package com.study.echarts.controller;

import com.study.echarts.domain.DeptUserCount;
import com.study.echarts.domain.PositionCount;
import com.study.echarts.domain.ScoreDistribution;
import com.study.echarts.service.DataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api")
public class DataController {

    @Autowired
    private DataService dataService;

    /**
     * 获取部门用户统计信息
     */
    @GetMapping("/departments")
    public List<DeptUserCount> getData() {
        return dataService.getDeptUserCounts();
    }

    /**
     * 获取职务分布统计信息
     */
    @GetMapping("/office")
    public List<PositionCount> getPositionDistribution() {
        return dataService.getPositionDistribution();
    }

    /**
     * 获取分数分布统计信息
     */
    @GetMapping("/score")
    public List<ScoreDistribution> getScoreDistribution() {
        return dataService.getScoreDistribution();
    }

}
